package com.dongxing.concyrrency.chapter3;

/**
 * @author XavierDong
 **/
public class CreateThread4 {

    private static int counter = 1;


    public static void main(String[] args) {

        Thread thread = new Thread(null, new Runnable() {
            @Override
            public void run() {
                try {
                    add(1);
                } catch (Error e) {
                    e.printStackTrace();
                    System.out.println(counter);
                }
            }

            private void add(int i) {
                counter++;
                add(i++);
            }
        }, "Test", 1 << 24);
        thread.start();
    }
}
